package org.eiahe.hr.attendance.domain.bo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.ehe.common.core.validate.AddGroup;
import org.ehe.common.core.validate.EditGroup;
import org.ehe.common.mybatis.core.domain.BaseEntity;
import org.eiahe.hr.attendance.domain.AttendanceRecord;
import org.ehe.common.core.xss.Xss;
import io.github.linpeilie.annotations.AutoMapper;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;

/**
 * 考勤明细业务对象 hr_attendance_record
 *
 * @author zhangnn
 */
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = AttendanceRecord.class, reverseConvertGenerate = false)
public class AttendanceRecordBo extends BaseEntity {

    /**
     * 记录ID
     */
    @NotNull(message = "记录ID不能为空", groups = { EditGroup.class })
    private Long recordId;

    /**
     * 工号
     */
    @NotBlank(message = "工号不能为空", groups = { AddGroup.class, EditGroup.class })
    private String employeeNo;

    private String employeeName;

    /**
     * 用户ID
     */
    @NotNull(message = "用户ID不能为空", groups = { AddGroup.class, EditGroup.class })
    private Long userId;

    /**
     * 考勤日期
     */
    @NotNull(message = "考勤日期不能为空", groups = { AddGroup.class, EditGroup.class })
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate attendanceDate;

    /**
     * 打卡时间
     */
    @NotNull(message = "打卡时间不能为空", groups = { AddGroup.class, EditGroup.class })
    @JsonFormat(pattern = "HH:mm:ss")
    private LocalTime clockTime;

    /**
     * 打卡类型(1上班 2下班)
     */
    private String clockType;

    /**
     * 打卡方式(1考勤机 2手机APP 3网页 4手动补录)
     */
    private String clockMethod;

    /**
     * 设备ID
     */
    private String deviceId;

    /**
     * 定位信息
     */
    private String location;

    /**
     * 考勤状态(0正常 1迟到 2早退 3旷工 4请假 5外勤 6非工作日)
     */
    private String attendanceStatus;

    /**
     * 异常原因
     */
    @Xss(message = "异常原因不能包含脚本字符")
    private String exceptionReason;

    /**
     * 是否重复打卡(0否 1是)
     */
    private String isDuplicate;

    /**
     * 备注
     */
    @Xss(message = "备注不能包含脚本字符")
    private String remark;
}
